package dao;

import java.util.Collection;

import web.dao.GenericDao;

import model.UserBean;

public class UserDao extends GenericDao<UserBean> {

	public UserDao() {
		super();
	}

	public UserBean getUserByName(String username) {
		Collection<UserBean> result = findByProperty("username", username);
		if (result.isEmpty()) {
			return null;
		} else {
			return result.iterator().next();
		}
	}

	public UserBean getUserByEmail(String email) {
		Collection<UserBean> result = findByProperty("email", email);
		if (result.isEmpty()) {
			return null;
		} else {
			return result.iterator().next();
		}
	}
}
